<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="my.dao.*" %>
<%

	String searchParam = request.getParameter("searchParam");

	String sql = "select * from goods g_name where 1=1";
	Object[] args = new Object[10];//定义足够长度的数组
	int size = 0;//数组中实际放入的参数个数
	
	if( searchParam !=null && !searchParam.equals("") ){
		sql += " and (g_name like ? or g_desc like ?)";
		args[size++]= "%"+searchParam+"%";
		args[size++]= "%"+searchParam+"%";
	}
	//将参数转移到恰当长度的数组
	Object[] _args = new Object[size];
	for(int i=0;i<_args.length;i++){
		_args[i]=args[i];
	}
	

	String json = MyDao.queryJsonArray(sql,_args);
	
	
	
	out.print(json);

%>